/**
 * @file ul
 * @date 2024/7/29
 * @author Yi Tao
 * @description Description
 */

// Your code here
window.onload = function () {
    // 获取地址栏信息
    let search = location.href;
    // 从后面向前截取
    // search=search.substring(search.lastIndexOf('/')+1);
    // search=search.substring(0,search.lastIndexOf('.'));
    console.log(search);
    let lis = document.getElementsByTagName('li');
    for (let i = 0; i < lis.length; i++) {
        let info = lis[i].getElementsByTagName("a")[0].href;
        if (search == info) {
            lis[i].getElementsByTagName("a")[0].className = "active";
        } else {
            lis[i].getElementsByTagName("a")[0].className = "";
        }
    }
}